package com.qf.gitadmin.user.service.impl;

import com.qf.entity.User;
import com.qf.gitadmin.user.mapper.UserMapper;
import com.qf.gitadmin.user.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * ---厚德载物---
 * Author fei
 * Date(2024/10/8)
 * Desc 希望我们都能遇到真诚的人
 * 一生要强的男人,我用双手成就你的梦想
 */
@Service
public class UserServiceImpl implements UserService {
    @Resource
    private UserMapper userMapper;
    @Override
    public User login(String username, String password) throws Exception {
        User user = userMapper.selectByUserName(username);
        if(user==null){
            throw new Exception("用户名为空");
        }
        if(!password.equals(user.getPassword())){
            throw new Exception("密码错误,请重新输入");
        }
        return user;
    }
}
